﻿using System;
using System.Collections.Generic;
using System.Text;
using GD.ModelContest.Model;
using System.Collections;

namespace GD.ModelContest.DataAccess.Impl.IBatisNet
{
    public class AdminSqlMapDao : BaseSqlMapDao, IAdminDao
    {
        #region mc_admin对象

        public bool InsertAdmin(mc_admin admin)
        {
            object obj = ExecuteInsert("Insertmc_admin", admin);

            if ((int)obj > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool UpdateAdmin(mc_admin admin)
        {
            int ret = ExecuteUpdate("Updatemc_admin", admin);

            if (ret > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool DeleteAdmin(int adminId)
        {
            object obj = ExecuteDelete("Deletemc_admin", adminId);

            if ((int)obj > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public mc_admin GetAdminByLogin(string adminName, string password)
        {
            Hashtable ht = new Hashtable();
            ht["adminname"] = adminName;
            ht["password"] = password;

            return ExecuteQueryForObject<mc_admin>("ChildSelectmc_admin", ht);
        }

        #endregion
    }
}
